﻿using UnityEngine;

namespace Core.Base
{
    public abstract class BaseUIMgr : BaseMgr
    {
        public override void OnInit()
        {
            base.OnInit();
            RegPanels();
        }

        /// <summary>
        /// 注册所有的Panel
        /// </summary>
        protected abstract void RegPanels();

        /// <summary>
        /// 注册Panel并初始化
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T RegPanel<T>() where T : BasePanel<T>
        {
            var panel = Object.FindObjectOfType<T>();
            panel.OnInit();
            return panel;
        }
    }
}